package com.isoftstone.project.system.mapper;


import com.isoftstone.framework.domain.Page;
import com.isoftstone.project.system.domain.SysMenu;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface SysMenuMapper {

    SysMenu getMenuById(@Param("menuId") String menuId)throws Exception;

    SysMenu getMenuByPermission(@Param("permission") String permission)throws Exception;

    List<SysMenu> getMenulistPage(Page page) throws Exception;

    List<SysMenu> getMenuAll(@Param("appId")String appId) throws Exception;

    void saveSysMenu(SysMenu menu)throws Exception;

    void updateSysMenu(SysMenu menu)throws Exception;

    void deleteSysMenu(@Param("menuId") String menuId)throws Exception;

    /**
     * 查询最顶级
     * menuType = URL
     * parentId = null
     * @return
     * @throws Exception
     */
    List<SysMenu> getMenuByUrl(@Param("userId") String userId, @Param("menuId") String menuId)throws Exception;

    /**
     * 根据角色查菜单
     * @param roleId
     * @return
     * @throws Exception
     */
    List<SysMenu> getMenuByRoleId(String roleId)throws Exception;

    /**
     * 查询下级
     * menuType = URL
     * @param parentId
     * @return
     * @throws Exception
     */
    List<SysMenu> getMenuByParentIdRoleId(@Param("parentId") String parentId, @Param("userId") String userId)throws Exception;

    List<SysMenu> getMenuByParentId(@Param("parentId") String parentId)throws Exception;

    /**
     * 根据用户ID查询用户对应的菜单权限
     * @param userId
     * @return
     * @throws Exception
     */
    List<String> getMenuByUserId(@Param("userId") String userId)throws Exception;

    List<SysMenu> getMenusByUserId(@Param("userId")String userId);
}
